package com.admission.web;

import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;
import org.springframework.beans.factory.annotation.Autowired;
import org.springside.modules.utils.web.struts2.Struts2Utils;

import com.admission.model.CollegeNotice;
import com.admission.service.CollegeNoticeManager;
import com.admission.util.CollegeDetailTips;

@Namespace("/base")
@Results({ @Result(name = CrudActionSupport.RELOAD, location = "/base/index.action", type = "redirect") })
public class CollegeNoticeAction extends CrudActionSupport<CollegeNotice> {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String value;
	private CollegeNotice entity;
	private CollegeNoticeManager collegeNoticeManager;

	public CollegeNotice getModel() {
		return entity;
	}

	@Override
	public String list() throws Exception {
		return SUCCESS;
	}

	public String getSpecialTips() {
		Struts2Utils.renderText(CollegeDetailTips.getSpecialTips(value));
//		if (collegeNoticeManager.getByType(value) != null)
//			Struts2Utils.renderText(collegeNoticeManager.getByType(value)
//					.getNote());
//		
		return null;
	}

	public String getNotice() {
		Struts2Utils.renderText(CollegeDetailTips.getNoticeTipes(value));
//		if (collegeNoticeManager.getByType(value) != null)
//			Struts2Utils.renderText(collegeNoticeManager.getByType(value)
//					.getContent());
		
		return null;
	}

	@Override
	public String input() throws Exception {
		return RELOAD;
	}

	@Override
	public String save() throws Exception {
		return RELOAD;
	}

	@Override
	public String delete() throws Exception {
		return RELOAD;
	}

	@Override
	protected void prepareModel() throws Exception {
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	public CollegeNotice getEntity() {
		return entity;
	}

	public void setEntity(CollegeNotice entity) {
		this.entity = entity;
	}

	public CollegeNoticeManager getCollegeNoticeManager() {
		return collegeNoticeManager;
	}

	@Autowired
	public void setCollegeNoticeManager(
			CollegeNoticeManager collegeNoticeManager) {
		this.collegeNoticeManager = collegeNoticeManager;
	}

}
